package com.example.liteflow.sw;

import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeSwitchComponent;
import com.yomahub.liteflow.slot.Slot;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;

/**
 * 选择组件
 *
 * @author chen.an
 * @date 2024-08-14 17:42
 */
@Slf4j
@LiteflowComponent(id = "SwitchNode1", name = "选择1")
public class SwitchNode1 extends NodeSwitchComponent {
    @Override
    public String processSwitch() throws Exception {
        Slot slot = this.getSlot();
        String data = slot.getRequestData();
        Map<String, String> node = Map.of("Node1", "Node1");
        log.info("SwitchNode1 节点组件【{}】-SwitchNode,获取数据：{},写入参数：{}", Thread.currentThread().threadId(), data, node);
        //传递请求数据
        slot.setRequestData(node);
        return data;
    }
}
